package com.museum.utils;

import com.alibaba.fastjson.JSONObject;
import com.museum.core.utils.RedisUtil;
import com.museum.entity.DTO.RedisInfo.UserMessage;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description:
 * @ClassName museum
 * @Author: 王瑞文
 * @Date: 2020/12/28 18:57
 */
public class GetAreaNumber {
    @Autowired
    private static RedisUtil redisUtil;

    public static Integer getAreaNumber(HttpServletRequest request) {
        String token = request.getHeader("Authorization");
        String value = redisUtil.getString(token);
        UserMessage userMessage = JSONObject.parseObject(value, UserMessage.class);
        Integer userID = userMessage.getUserId();
        Integer areaNumber = userMessage.getAreaNumber();
        return areaNumber;
    }
}
